﻿using System;
using System.Configuration;
using Dexter.Web.Mvc.ResourceCombiner;

namespace Dexter.Web.Mvc.Configuration.OnPremise {
	/// <summary>
	/// 	The configuration section will all <see cref = "ICombiner" /> parameters
	/// </summary>
	public class ResourceConfigurationSection : ConfigurationSection {
		/// <summary>
		/// 	Allow the combiner to minify the combined output.
		/// </summary>
		/// <value>The throw exception on missing files.</value>
		[ConfigurationProperty ( "minify", IsRequired = false, DefaultValue = true )]
		public bool Minify {
			get { return ( bool )this["minify"]; }
			set { this["minify"] = value; }
		}

		/// <summary>
		/// 	Allow the combiner to throw exception where a missing file is add to combined output.
		/// </summary>
		/// <value>The throw exception on missing files.</value>
		[ConfigurationProperty ( "throwExceptionOnMissingFiles", IsRequired = false, DefaultValue = false )]
		public bool ThrowExceptionOnMissingFiles {
			get { return ( bool )this["throwExceptionOnMissingFiles"]; }
			set { this["throwExceptionOnMissingFiles"] = value; }
		}

		/// <summary>
		/// 	Define the time for the timeout of the client side cache
		/// </summary>
		/// <value>The cache for.</value>
		[ConfigurationProperty ( "cacheFor", IsRequired = false, DefaultValue = "7.00:00:00" )]
		[TimeSpanValidator ( MinValueString = "0:0:00", MaxValueString = "10675199.02:48:05.4775807", ExcludeRange = false )]
		public TimeSpan CacheFor {
			get { return ( TimeSpan )base["cacheFor"]; }
			set { this["cacheFor"] = value; }
		}
	}
}
